package com.ytxg.practice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ytxg.practice.po.Park;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ParkMapper extends BaseMapper<Park> {
    @Select("select *from park ")
    List<Park> getCarList();

    @Insert("insert into Park(name,price,status,address,diquId,jingduX,jingduY)  values(#{name},#{price},0,#{address},#{diquId},#{jingduX},#{jingduY})")
    void addCar(Park car);

    @Delete("delete from park where id = ${carId}")
    void delCar(Integer carId);

    @Select("select * from park where id = #{carId} ")
    Park getOneCar(Integer carId);

    @Update("update park set name=#{name},price=#{price},address=#{address},jingduX=#{jingduX},jingduY=#{jingduY},diquId=#{diquId} where id=#{id}")
    void carUpdate(Park car);

    @Select("select * from park where `name` like #{key} ")
    List<Park> findCarByKey(String key);
}
